﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace LightCAD.Core
{

    public class Shape2dCreator
    {
        public List<ICurve2d> Curves { get; }
        public Shape2dCreator()
        {
            Curves = new List<ICurve2d>();
        }
        public Shape2dCreator(List<ICurve2d> curves)
        {
            this.Curves = curves;
        }
        public Vector2d Point(double x, double y)
        {
            return new Vector2d(x, y);
        }

        public Vector2d RotatePoint(Vector2d p0, Vector2d p1, double angleDegree)
        {
            return Vector2d.Rotate(p0, p1, angleDegree);
        }

        public void DrawArc(Vector2d center, double radius, double startAngle, double endAngle)
        {
            var arc = new Arc2d
            {
                 Center = center,
                 Radius = radius,
                 StartAngle = startAngle,
                 EndAngle = endAngle
            };
            Curves.Add(arc);
        }

        public void DrawLine(Vector2d start, Vector2d end)
        {
            var line = new Line2d
            {
                Start = start,
                End = end
            };
            Curves.Add(line);
        }
        public void DrawRect(Vector2d min, Vector2d max) 
        {
            var rect = new Rect2d() { Min = min, Max = max };
            Curves.Add(rect);
        }

        public void DrawPolygon(params Vector2d[] points)
        {
            var polygon = new Polygon2d
            {
                Points = points,
            };
            Curves.Add(polygon);
        }
    }
}
